import config from '@/config/config.js';
import http from '@/api/http.js'

let workmanshipMaterialRequest={
    list(workmanshipMaterial,page=1,limit=10,callBack){
        // 获取token
        let token = localStorage.getItem("token");
        if(token){
            let url = config.productionBaseUrl + "/workmanshipMaterial/list?page="+page + "&limit=" + limit;
            console.log(url);
            http.post(url,workmanshipMaterial,callBack);
        }else{
            callBack(undefined);
        }
    },add(workmanshipMaterial,callBack){
        let token = localStorage.getItem("token");
        if(token){
            let url = config.productionBaseUrl + "/workmanshipMaterial/add";
            console.log(url);
            http.post(url,workmanshipMaterial,callBack);
        }else{
            callBack(undefined);
        }
    },listById(workmanshipMaterial,callBack){
        let token = localStorage.getItem("token");
        if(token){
            let url = config.productionBaseUrl + "/workmanshipMaterial/listById";
            console.log(url);
            http.post(url,workmanshipMaterial,callBack);
        }else{
            callBack(undefined);
        }
    },edit(workmanshipMaterial,callBack){
        let token = localStorage.getItem("token");
        if(token){
            let url = config.productionBaseUrl + "/workmanshipMaterial/edit";
            console.log(url);
            http.post(url,workmanshipMaterial,callBack);
        }else{
            callBack(undefined);
        }
    }
}

export default workmanshipMaterialRequest;